<template>
  <div class="wdStudioView pd-20">
    <div class="detailView">
      <div class="detail">
        <div class="name">工作室名称</div>
        <div class="value">{{item.name}}</div>
      </div>
      <div class="detail">
        <div class="name">工作室头像</div>
        <div class="value">
          <img :src="item.imgUrl"
               alt="工作室头像"
               preview="bannerView">
        </div>
      </div>
      <div class="detail">
        <div class="name">工作室类别</div>
        <div class="value">{{item.typeName}}</div>
      </div>
      <div class="detail">
        <div class="name">责任医生</div>
        <div class="value">{{item.doctorDto ? item.doctorDto.nickName : ''}}</div>
      </div>
      <div class="detail">
        <div class="name">医院</div>
        <div class="value">{{item.doctorDto ? item.doctorDto.hospitalName : ''}}</div>
      </div>
      <div class="detail">
        <div class="name">是否完整</div>
        <div class="value">{{item.isComplete=='1'?'完整':'不完整'}}</div>
      </div>
      <div class="detail">
        <div class="name">二维码</div>
        <div class="value">
          <img :src="item.qrCodeUrl"
               alt="二维码"
               preview="bannerView">
        </div>
      </div>
      <div class="detail">
        <div class="name">介绍</div>
        <div class="value">{{item.introduce}}</div>
      </div>
      <Table border
             stripe
             :columns="tableCol"
             :data="item.wdStudioDoctorDto"
             class="mt-20"></Table>
      <p align="center"
         class="mt-20 goPage">
        <Button type="primary"
                @click="goPage">返 回</Button>
      </p>
    </div>
  </div>
</template>

<script>
  import { activityMgt } from '@/api/codeName'
  export default {
    name: "wdStudioView",
    data () {
      return {
        item: {},
        tableCol: [
          {
            type: 'index2',
            title: '',
            width: 60,
            render: (h, params) => {
              return h('span', params.index + 1);
            }
          },
          {
            title: '医生头像',
            key: 'doctorImg',
            // width: 95,
            render: (h, params) => {
              return h('div', [
                h('img', {
                  attrs: {
                    src: params.row.doctorImg,
                    preview: 'wdStudioList'
                  },
                  style: {
                    width: '50px',
                    height: '50px',
                    margin: '10px',
                    borderRadius: '50%'
                  }
                }),
              ]);
            }
          },
          {
            title: '医生名称',
            key: 'doctorName',
          },
          {
            title: '医院',
            key: 'hospitalName',
          },
          {
            title: '科室',
            key: 'departmentName',
            render: (h, params) => {
              return h('span', params.row.doctorDto.departmentName)
            }
          },
          {
            title: '职称',
            key: 'positionName',
          },
          {
            title: '是否通过',
            key: 'applyFlag',
            render: (h, params) => {
              if (params.row.isExpert == '1') {
                return h('span', '通过');
              } else {
                return h('span', '待审核');
              }
            }
          },
          {
            title: '申请类容',
            key: 'applyContent',
          },
          {
            title: '申请时间',
            key: 'createTime',
            width: 150,
            render: (h, params) => {
              return h('span',
                this.commonFunction.timestampFormat(new Date(params.row.createTime), 'yyyy-MM-dd hh:mm'));
            }
          }
        ],
      }
    },
    mounted () {
      this._getViewById()
    },
    methods: {
      _getViewById () {
        this.ajax({
          type: this.api.wdStudioView.type,
          url: this.api.wdStudioView.url,
          data: {
            id: this.$route.query.id
          },
          success: (data) => {
            this.item = data.object
            this.$previewRefresh()
          },
          error: (data) => {
            this.$Message.error(data.message);
          }
        })
      },
      goPage () {
        this.$router.push({ name: 'wdStudioList' })
      }
    },
    filters: {
      typeId: (value, wdStudioAllTypeList) => {
        for (let i = 0; i < wdStudioAllTypeList.length; i++) {
          if (value == wdStudioAllTypeList[i].id) {
            return wdStudioAllTypeList[i].name
          }
        }
        return value
      }
    }
  }
</script>

<style lang="scss" type="text/scss" rel="stylesheet/scss">
  .wdStudioView {
  }
  .goPage {
    padding-bottom: 20px;
  }
</style>
